package com.saudidentalapp;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.text.Html;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ImageView;
import android.widget.TextView;

import com.saudiapp.webservice.Constants;
import com.saudiapp.webservice.Responce;
import com.saudiapp.webservice.Utilities;
import com.saudiapp.webservice.WebServiceManager;
import com.saudiapp.webservice.WebServiceManager.WebServiceListener;

public class AroundTown extends Activity implements WebServiceListener
{
	TextView txtAroundTownDescription;
	Utilities utilities;
	AroundTown activity;
	 @Override
	protected void onCreate(Bundle savedInstanceState) 
	 {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_around_town);
		txtAroundTownDescription=(TextView)findViewById(R.id.xtxtAroundTown);
		setView();
		
	}
	 
	private void setView()
	{
		activity=this;
		utilities=Utilities.getInstance(AroundTown.this);
		utilities.showProgreessDialog();
		
		if(utilities.haveNetworkConnection())
		{
			WebServiceManager webServiceManager=new WebServiceManager(this);
			webServiceManager.setonWebServiceListener(this);
			webServiceManager.getAboutSaudi();
			
		}
		else
		{utilities.dismiss();
			utilities.showToast(Constants.INTERNET_NOT_AVAILABELE);
		}
		
		
		
		ImageView imgBack=(ImageView)findViewById(R.id.xbtnVwBack);
		imgBack.setOnClickListener(new OnClickListener() 
		{
			
			@Override
			public void onClick(View arg0) 
			{
				finish();
				startActivity(new Intent(activity,TabActivity.class).addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP));
				
			}
		});
		
	}

	@Override
	public void onProcesCompleted(int requestId, Object Data) 
	{	
		utilities.dismiss();
		txtAroundTownDescription.setText(Html.fromHtml(((Responce)Data).getResponceData().toString()));
	}

	@Override
	public void onErrorOccured(int requestId) 
	{
		utilities.dismiss();	
		utilities.showToast(Constants.ERROR_MESSAGE);
		
	}
	 
}
